#include <iostream>
#include <windows.h>
#include <time.h>
#include <string>
#include <fstream>

void printsnake() {
    system("cls");
    std::ifstream file("snake.txt");

    std::string line;
    
    setColor(2);
    while (std::getline(file, line)) {
        std::cout << line << std::endl;
    }

    file.close();
    setColor(15);
	return;
}

void welcometogame() {
    printsnake();
    setColor(12);
    int res;
    if (!readMaxScore("record.txt", res)) {
        gotoxy(0, 50);
        std::cout << "请用管理员模式运行,效果更佳！";
    }
    setColor(15);
    gotoxy(1, 50);
    std::cout << "输入1开始游戏";
    gotoxy(2, 50);
    std::cout << "输入2查看最高分";
    gotoxy(3, 50);
    std::cout << "输入3查看游戏说明";
    gotoxy(4, 50);
    std::cout << "输入4退出游戏";


    gotoxy(5, 50);
    std::cout << "请输入：";
    while (1) {
        for (int i = 1;i <= 2000;i++)++score;
        for (int i = 1;i <= 2000;i++)--score;
		if (GetAsyncKeyState('1') & 0x8000) {
			mode = 1;
			break;
		}
        if (GetAsyncKeyState('2') & 0x8000) {
            mode = 2;
            break;
        }
		if (GetAsyncKeyState('3') & 0x8000) {
			mode = 3;
			break;
		}
        if (GetAsyncKeyState('4') & 0x8000) {
            mode = 4;
            break;
        }
    }
    return;
}
